import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

# 文件路径
file_path = r"C:\Users\zeng\Desktop\train.csv"

# 读取CSV文件
df = pd.read_csv(file_path)

# 检查缺失值并清理
df_cleaned = df.dropna()

# 将 'running' 列转换为数值类型，无法转换的设置为NaN，并删除这些行
df_cleaned['running'] = pd.to_numeric(df_cleaned['running'], errors='coerce')
df_cleaned = df_cleaned.dropna(subset=['running'])

# 选择数值型特征
numeric_features = df_cleaned.select_dtypes(include=['number']).columns.tolist()

# 创建箱线图
plt.figure(figsize=(10, 8))
sns.boxplot(data=df_cleaned[numeric_features])
plt.title('Boxplot for Numeric Features')
plt.xticks(rotation=90)  # 旋转x轴标签以便更好地显示
plt.show()